﻿<UserControl x:Class="FacebookClient.PhotoTaggerControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:FacebookClient"
    xmlns:contigo="clr-namespace:Contigo;assembly=Contigo"
    x:Name="TagBin"
    Width="250" Height="347"
    Visibility="Visible">
  <UserControl.Resources>
    <SolidColorBrush x:Key="TagBinBorder" Color="#FFC1FFFA"/>
    <SolidColorBrush x:Key="TagBinBackground" Color="#FF000000"/>
    <SolidColorBrush x:Key="TagBinLabelText" Color="#FFB6B6B6"/>
    <SolidColorBrush x:Key="TagBinUserNameText" Color="White"/>
    <SolidColorBrush x:Key="TagBinUserNameBackgroundMouseOver" Color="#FF555555"/>
    <DataTemplate x:Key="NameListDataTemplate" DataType="{x:Type contigo:FacebookContact}">
      <Grid>
        <CheckBox x:Name="CheckBox" Margin="5,5,5,0" VerticalAlignment="Center" Foreground="{DynamicResource TagBinUserNameText}" Content="{Binding Name}" Checked="CheckBox_Checked"/>
      </Grid>
    </DataTemplate>
    <Style x:Key="NameListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ListBoxItem}">
            <Grid Cursor="Hand" Background="#00000000">
              <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    <Storyboard x:Key="FadeInStoryboard" BeginTime="00:00:00">
      <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TagBin" Storyboard.TargetProperty="(UIElement.Visibility)">
        <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
      </ObjectAnimationUsingKeyFrames>
      <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="TagBin" To="1" Storyboard.TargetProperty="(UIElement.Opacity)"/>
    </Storyboard>
    <Storyboard x:Key="FadeOutStoryboard">
      <DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.2"  Storyboard.TargetName="TagBin" To="0" Storyboard.TargetProperty="(UIElement.Opacity)"/>
      <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="TagBin" Storyboard.TargetProperty="(UIElement.Visibility)">
        <DiscreteObjectKeyFrame KeyTime="00:00:00.2" Value="{x:Static Visibility.Collapsed}"/>
      </ObjectAnimationUsingKeyFrames>
    </Storyboard>
  </UserControl.Resources>

  <Border BorderBrush="#FFC1FFFA" BorderThickness="3" CornerRadius="15" Background="Black" Margin="0,0,0,-30" SnapsToDevicePixels="True">
    <StackPanel Margin="10">
      <TextBlock x:Name="NameFilterLabel" Text="Enter a name" TextWrapping="Wrap" Background="{x:Null}" Foreground="{DynamicResource TagBinLabelText}"/>
			<TextBox x:Name="NameFilterTextBox" TextWrapping="Wrap" BorderBrush="{x:Null}" Margin="0,0,0,10" TextChanged="TextBox_TextChanged"/>
			<TextBlock x:Name="SelectNameLabel" Text="Or select a name" TextWrapping="Wrap" Foreground="{DynamicResource TagBinLabelText}"/>
			<ListBox x:Name="RelevantNames" ItemsSource="{Binding ElementName=TagBin, Path=RelevantFriends}" SelectionMode="Single" SelectedIndex="-1" Height="86" IsSynchronizedWithCurrentItem="True" Background="{x:Null}" BorderBrush="#FF828790" ItemTemplate="{DynamicResource NameListDataTemplate}" ItemContainerStyle="{DynamicResource NameListBoxItemStyle}"/>
			<Path x:Name="Seperator" Fill="{x:Null}" Stretch="Fill" Stroke="White" Margin="10" Height="1" Data="M8,171 L216.00962,171" StrokeThickness="3">
				<Path.OpacityMask>
					<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
						<GradientStop Offset="0"/>
						<GradientStop Offset="1"/>
						<GradientStop Color="Black" Offset="0.5"/>
					</LinearGradientBrush>
				</Path.OpacityMask>
			</Path>
			<ListBox x:Name="FilteredNames" ItemsSource="{Binding ElementName=TagBin, Path=FilteredFriends}" SelectionMode="Single" SelectedIndex="-1" IsSynchronizedWithCurrentItem="True" Background="{x:Null}" Margin="0" Height="140" ItemTemplate="{DynamicResource NameListDataTemplate}" ItemContainerStyle="{DynamicResource NameListBoxItemStyle}"/>
			<Grid x:Name="NavigationButtons" Height="30" Margin="0,10,0,0">
				<Button x:Name="Cancel" HorizontalAlignment="Center" Width="75" Content="Cancel" VerticalAlignment="Center" Click="Cancel_Click"/>
			</Grid>
		</StackPanel>
  </Border>
</UserControl>
